﻿<%@ Page Language="C#" AutoEventWireup="true" validateRequest="false" CodeFile="Default.aspx.cs" Inherits="Administration_Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title>SilverlightDesktop - Administration</title>
    <style type="text/css">
        .style1
        {
            width: 500px;
        }
        .style2
        {
            width: 20px;
        }
        .style3
        {
            text-align: right;
        }
        .style4
        {
            text-align: right;
            width: 273px;
        }
    </style>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <img alt="SilverlightDesktop Administration" src="../images/SilverlightDesktop_small.gif"
            style="width: 264px; height: 122px" /></div>
    <h2>
        Administration</h2>
    <p>
        <asp:LinkButton ID="lnkBack" runat="server" PostBackUrl="~/Default.aspx">Back to 
        Main</asp:LinkButton>
    </p>
    <asp:Menu ID="AdministrationMenu" runat="server" BackColor="#E3EAEB" DynamicHorizontalOffset="2"
        Font-Names="Verdana" Font-Size="1.0em" ForeColor="#666666" Orientation="Horizontal"
        StaticSubMenuIndent="10px" OnMenuItemClick="AdministrationMenu_MenuItemClick">
        <StaticSelectedStyle BackColor="Yellow" />
        <StaticMenuItemStyle HorizontalPadding="5px" VerticalPadding="2px" />
        <DynamicHoverStyle BackColor="#666666" ForeColor="White" />
        <DynamicMenuStyle BackColor="#E3EAEB" />
        <DynamicSelectedStyle BackColor="#1C5E55" />
        <DynamicMenuItemStyle HorizontalPadding="5px" VerticalPadding="2px" />
        <StaticHoverStyle BackColor="#666666" ForeColor="White" />
        <Items>
            <asp:MenuItem Text="General Settings" ToolTip="Basic application settings" Value="General Settings">
            </asp:MenuItem>
            <asp:MenuItem Text="User Management" ToolTip="Add delete and edit users" Value="User Management">
            </asp:MenuItem>
            <asp:MenuItem Text="Module Settings" ToolTip="Set security for modules" Value="Module Settings">
            </asp:MenuItem>
            <asp:MenuItem Text="Desktops" ToolTip="Manage SilverlightDesktop instances" Value="Desktops">
            </asp:MenuItem>
            <asp:MenuItem Text="Application Log" ToolTip="Applications events and errors" Value="Application Log">
            </asp:MenuItem>
        </Items>
    </asp:Menu>
    <asp:MultiView ID="mvAdministration" runat="server">
        <asp:View ID="vwGeneralSettings" runat="server">
            <h2>
                General Settings</h2>
            <table align="left" cellpadding="4" class="style1">
                <tr>
                    <td class="style4">
                        Version:
                    </td>
                    <td class="style2">
                        &nbsp;
                    </td>
                    <td>
                        <asp:Label ID="lblVersion" runat="server"></asp:Label>
                    </td>
                </tr>
                <tr>
                    <td class="style4">
                        Allow anonymous users:
                    </td>
                    <td class="style2">
                        &nbsp;
                    </td>
                    <td>
                        <asp:DropDownList ID="ddlAnonymousLogin" runat="server">
                            <asp:ListItem>True</asp:ListItem>
                            <asp:ListItem>False</asp:ListItem>
                        </asp:DropDownList>
                    </td>
                </tr>
                <tr>
                    <td class="style4">
                        Maximum password attempts:
                    </td>
                    <td class="style2">
                        &nbsp;
                    </td>
                    <td>
                        <asp:TextBox ID="txtMaxPasswordAttempts" runat="server" Columns="3" MaxLength="8"></asp:TextBox>
                        <asp:RequiredFieldValidator ID="vMaximumPasswordAttempts" runat="server" ControlToValidate="txtMaxPasswordAttempts"
                            ErrorMessage="Maxium password attempts must have a value">*</asp:RequiredFieldValidator>
                        <asp:RangeValidator ID="RangeValidator1" runat="server" ControlToValidate="txtMaxPasswordAttempts"
                            ErrorMessage="Maxium password attempts must be a number" MaximumValue="999999"
                            MinimumValue="0" Type="Integer">*</asp:RangeValidator>
                    </td>
                </tr>
                <tr>
                    <td class="style4">
                        &nbsp;
                    </td>
                    <td class="style2">
                        &nbsp;
                    </td>
                    <td>
                        &nbsp;
                    </td>
                </tr>
                <tr>
                    <td class="style4">
                        SMTP Server and port:
                    </td>
                    <td class="style2">
                        &nbsp;
                    </td>
                    <td>
                        <asp:TextBox ID="txtSMTPEmailServer" runat="server" MaxLength="50"></asp:TextBox>
                    </td>
                </tr>
                <tr>
                    <td class="style4">
                        SMTP Authendication:
                    </td>
                    <td class="style2">
                        &nbsp;
                    </td>
                    <td>
                        <asp:RadioButtonList ID="rbAuthendication" runat="server" RepeatDirection="Horizontal">
                            <asp:ListItem Selected="True" Value="0">Anonymous</asp:ListItem>
                            <asp:ListItem Value="1">Basic</asp:ListItem>
                            <asp:ListItem Value="2">NTLM</asp:ListItem>
                        </asp:RadioButtonList>
                    </td>
                </tr>
                <tr>
                    <td class="style4">
                        Use secure SMTP access:
                    </td>
                    <td class="style2">
                        &nbsp;
                    </td>
                    <td>
                        <asp:CheckBox ID="chkSecureAccess" runat="server" />
                    </td>
                </tr>
                <tr>
                    <td class="style4">
                        SMTP Username:
                    </td>
                    <td class="style2">
                        &nbsp;
                    </td>
                    <td>
                        <asp:TextBox ID="txtSMTPUsername" runat="server" MaxLength="50"></asp:TextBox>
                    </td>
                </tr>
                <tr>
                    <td class="style4">
                        SMTP Password:
                    </td>
                    <td class="style2">
                        &nbsp;
                    </td>
                    <td>
                        <asp:TextBox ID="txtSMTPPassword" runat="server" MaxLength="50"></asp:TextBox>
                    </td>
                </tr>
                <tr>
                    <td class="style4">
                        SMTP &quot;From&quot; email address:
                    </td>
                    <td class="style2">
                        &nbsp;
                    </td>
                    <td>
                        <asp:TextBox ID="txtSMTPFrom" runat="server" Columns="40" MaxLength="50"></asp:TextBox>
                    </td>
                </tr>
                <tr>
                    <td class="style4">
                        &nbsp;
                    </td>
                    <td class="style2">
                        &nbsp;
                    </td>
                    <td>
                        <asp:LinkButton ID="lnkTestEmail" runat="server" OnClick="lnkTestEmail_Click" ToolTip="This uses the settings on the form right now, not the last saved settings.">[Send 
                        Test Email]</asp:LinkButton>
                    </td>
                </tr>
                <tr>
                    <td class="style4">
                        &nbsp;
                    </td>
                    <td class="style2">
                        &nbsp;
                    </td>
                    <td>
                    </td>
                </tr>
                <tr>
                    <td class="style3" colspan="3">
                        <asp:ValidationSummary ID="VSummary" runat="server" />
                    </td>
                </tr>
                <tr>
                    <td class="style4">
                        <asp:Label ID="lblUpdated" runat="server" EnableViewState="False" ForeColor="Blue"></asp:Label>
                    </td>
                    <td class="style2">
                        &nbsp;
                    </td>
                    <td>
                        <asp:Button ID="btnUpdateSettings" runat="server" OnClick="btnUpdateSettings_Click"
                            Text="Update Settings" />
                    </td>
                </tr>
            </table>
        </asp:View>
        <asp:View ID="vwUserManagement" runat="server">
            <h2>
                User Management</h2>
            <p>
                <asp:ListView ID="lvUsers" runat="server" DataKeyNames="UserID" DataSourceID="LDSUsers"
                    InsertItemPosition="LastItem" OnItemInserted="lvUsers_ItemInserted" OnItemUpdated="lvUsers_ItemUpdated">
                    <LayoutTemplate>
                        <table id="Table1" runat="server">
                            <tr id="Tr1" runat="server">
                                <td id="Td1" runat="server">
                                    <table id="itemPlaceholderContainer" runat="server" border="0" style="">
                                        <tr id="Tr2" runat="server" style="">
                                            <th id="Th1" runat="server">
                                            </th>
                                            <th id="Th2" runat="server">
                                                UserID
                                            </th>
                                            <th id="Th3" runat="server">
                                                User Name
                                            </th>
                                            <th id="Th4" runat="server">
                                                Password
                                            </th>
                                            <th id="Th5" runat="server">
                                                First Name
                                            </th>
                                            <th id="Th6" runat="server">
                                                Last Name
                                            </th>
                                            <th id="Th7" runat="server">
                                                Email
                                            </th>
                                            <th id="Th8" runat="server">
                                                Role
                                            </th>
                                            <th id="Th9" runat="server">
                                                Active
                                            </th>
                                            <th id="Th10" runat="server">
                                                SuperUser
                                            </th>
                                        </tr>
                                        <tr id="itemPlaceholder" runat="server">
                                        </tr>
                                    </table>
                                </td>
                            </tr>
                            <tr id="Tr3" runat="server">
                                <td id="Td2" runat="server" style="">
                                    <asp:DataPager ID="DataPager1" runat="server">
                                        <Fields>
                                            <asp:NextPreviousPagerField ButtonType="Button" ShowFirstPageButton="True" ShowNextPageButton="False"
                                                ShowPreviousPageButton="False" />
                                            <asp:NumericPagerField />
                                            <asp:NextPreviousPagerField ButtonType="Button" ShowLastPageButton="True" ShowNextPageButton="False"
                                                ShowPreviousPageButton="False" />
                                        </Fields>
                                    </asp:DataPager>
                                </td>
                            </tr>
                        </table>
                    </LayoutTemplate>
                    <InsertItemTemplate>
                        <tr style="">
                            <td>
                                <br />
                                <asp:Button ID="InsertButton" runat="server" CommandName="Insert" Text="Insert" ValidationGroup="Insert" /><br />
                                <br />
                            </td>
                            <td>
                                &nbsp;
                            </td>
                            <td>
                                <br />
                                <asp:TextBox ID="UserNameTextBox" runat="server" Text='<%# Bind("UserName") %>' MaxLength="50"
                                    ValidationGroup="Insert" /><br />
                                <asp:RequiredFieldValidator ID="valUserName" runat="server" ErrorMessage="User Name is required"
                                    ControlToValidate="UserNameTextBox" ValidationGroup="Insert"></asp:RequiredFieldValidator>
                            </td>
                            <td>
                                <br />
                                <asp:TextBox ID="PasswordTextBox" runat="server" Text='<%# Bind("Password") %>' MaxLength="50"
                                    TextMode="Password" ValidationGroup="Insert" /><br />
                                <asp:RequiredFieldValidator ID="valPassword" runat="server" ErrorMessage="Password is required"
                                    ControlToValidate="PasswordTextBox" ValidationGroup="Insert"></asp:RequiredFieldValidator>
                            </td>
                            <td>
                                <br />
                                <asp:TextBox ID="FirstNameTextBox" runat="server" Text='<%# Bind("FirstName") %>'
                                    MaxLength="50" /><br />
                                <br />
                            </td>
                            <td>
                                <br />
                                <asp:TextBox ID="LastNameTextBox" runat="server" Text='<%# Bind("LastName") %>' MaxLength="50" /><br />
                                <br />
                            </td>
                            <td>
                                <br />
                                <asp:TextBox ID="EmailTextBox" runat="server" Text='<%# Bind("Email") %>' MaxLength="50" /><br />
                                <br />
                            </td>
                            <td>
                                <br />
                                <asp:DropDownList ID="ddlRoles" runat="server" SelectedValue='<%# Bind("Role") %>'>
                                    <asp:ListItem>Administrators</asp:ListItem>
                                    <asp:ListItem Selected="True">Users</asp:ListItem>
                                </asp:DropDownList>
                                <br />
                                <br />
                            </td>
                            <td>
                                <br />
                                <asp:CheckBox ID="ActiveCheckBox" runat="server" Checked='<%# Bind("Active") %>' /><br />
                                <br />
                            </td>
                            <td>
                                <br />
                                <asp:CheckBox ID="SuperUserCheckBox" runat="server" Checked='<%# Bind("SuperUser") %>' /><br />
                                <br />
                            </td>
                        </tr>
                    </InsertItemTemplate>
                    <EmptyDataTemplate>
                        <table id="Table2" runat="server" style="">
                            <tr>
                                <td>
                                    No data was returned.
                                </td>
                            </tr>
                        </table>
                    </EmptyDataTemplate>
                    <EditItemTemplate>
                        <tr style="">
                            <td>
                                <asp:Button ID="UpdateButton" runat="server" CommandName="Update" Text="Update" ValidationGroup="Edit" />
                                <asp:Button ID="CancelButton" runat="server" CommandName="Cancel" Text="Cancel" CausesValidation="False" /><br />
                                <br />
                            </td>
                            <td>
                                <asp:Label ID="UserIDLabel1" runat="server" Text='<%# Eval("UserID") %>' /><br />
                                <br />
                            </td>
                            <td>
                                <asp:Label ID="lblUserName" runat="server" Text='<%# Eval("UserName") %>' /><br />
                                <br />
                            </td>
                            <td>
                                <asp:TextBox ID="PasswordTextBox" runat="server" Text='<%# Bind("Password") %>' MaxLength="50" /><br />
                                <asp:RequiredFieldValidator ID="valPassword" runat="server" ErrorMessage="Password is required"
                                    ControlToValidate="PasswordTextBox" ValidationGroup="Edit"></asp:RequiredFieldValidator>
                            </td>
                            <td>
                                <asp:TextBox ID="FirstNameTextBox" runat="server" Text='<%# Bind("FirstName") %>'
                                    MaxLength="50" /><br />
                                <br />
                            </td>
                            <td>
                                <asp:TextBox ID="LastNameTextBox" runat="server" Text='<%# Bind("LastName") %>' MaxLength="50" /><br />
                                <br />
                            </td>
                            <td>
                                <asp:TextBox ID="EmailTextBox" runat="server" Text='<%# Bind("Email") %>' MaxLength="50"
                                    Columns="40" /><br />
                                <br />
                            </td>
                            <td>
                                <asp:DropDownList ID="ddlRoles" runat="server" SelectedValue='<%# Bind("Role") %>'>
                                    <asp:ListItem>Administrators</asp:ListItem>
                                    <asp:ListItem>Users</asp:ListItem>
                                </asp:DropDownList>
                                <br />
                                <br />
                            </td>
                            <td>
                                <asp:CheckBox ID="ActiveCheckBox" runat="server" Checked='<%# Bind("Active") %>' /><br />
                                <br />
                            </td>
                            <td>
                                <asp:CheckBox ID="SuperUserCheckBox" runat="server" Checked='<%# Bind("SuperUser") %>' /><br />
                                <br />
                            </td>
                        </tr>
                    </EditItemTemplate>
                    <ItemTemplate>
                        <tr style="">
                            <td>
                                <asp:Button ID="DeleteButton" runat="server" CommandName="Delete" Text="Delete" OnClientClick="return confirm('Are you certain you want to delete ?');" />
                                <asp:Button ID="EditButton" CausesValidation="False" runat="server" CommandName="Edit"
                                    Text="Edit" />
                            </td>
                            <td>
                                <asp:Label ID="UserIDLabel" runat="server" Text='<%# Eval("UserID") %>' />
                            </td>
                            <td>
                                <asp:Label ID="UserNameLabel" runat="server" Text='<%# Eval("UserName") %>' />
                            </td>
                            <td>
                                <asp:Label ID="PasswordLabel" runat="server" Text='*******' />
                            </td>
                            <td>
                                <asp:Label ID="FirstNameLabel" runat="server" Text='<%# Eval("FirstName") %>' />
                            </td>
                            <td>
                                <asp:Label ID="LastNameLabel" runat="server" Text='<%# Eval("LastName") %>' />
                            </td>
                            <td>
                                <asp:Label ID="EmailLabel" runat="server" Text='<%# Eval("Email") %>' />
                            </td>
                            <td>
                                <asp:Label ID="txtRole" runat="server" Text='<%# Eval("Role") %>' />
                            </td>
                            <td>
                                <asp:CheckBox ID="ActiveCheckBox" runat="server" Checked='<%# Eval("Active") %>'
                                    Enabled="false" />
                            </td>
                            <td>
                                <asp:CheckBox ID="SuperUserCheckBox" runat="server" Checked='<%# Eval("SuperUser") %>'
                                    Enabled="false" />
                            </td>
                        </tr>
                    </ItemTemplate>
                </asp:ListView>
            </p>
            <p>
                <asp:Label ID="lblError" runat="server" EnableViewState="False" Font-Bold="True"
                    ForeColor="Red"></asp:Label>
            </p>
        </asp:View>
        <asp:View ID="vwModuleSettings" runat="server">
            <h2>
                Module Settings</h2>
            <asp:Panel ID="pnlInsertDesktop" runat="server">
            </asp:Panel>
            <p>
                <asp:ListView ID="ListView1" runat="server" DataKeyNames="ModuleID" DataSourceID="LDSModuleSettings"
                    InsertItemPosition="LastItem" OnItemInserted="ListView1_ItemInserted" OnItemDeleting="ListView1_ItemDeleting">
                    <LayoutTemplate>
                        <table runat="server">
                            <tr runat="server">
                                <td runat="server">
                                    <table id="itemPlaceholderContainer" runat="server" border="1" style="background-color: #FFFFFF;
                                        border-collapse: collapse; border-color: #999999; border-style: none; border-width: 1px;
                                        font-family: Verdana, Arial, Helvetica, sans-serif;">
                                        <tr runat="server" style="background-color: #E0FFFF; color: #333333;">
                                            <th runat="server">
                                            </th>
                                            <th runat="server">
                                                Name
                                            </th>
                                            <th runat="server">
                                                Description
                                            </th>
                                            <th runat="server">
                                                Assembly
                                            </th>
                                            <th runat="server">
                                                Class
                                            </th>
                                            <th runat="server">
                                                Icon
                                            </th>
                                            <th runat="server">
                                                Role
                                            </th>
                                            <th runat="server">
                                                WindowSize
                                            </th>
                                            <th runat="server">
                                                Multiple?
                                            </th>
                                            <th runat="server">
                                                Version
                                            </th>
                                        </tr>
                                        <tr id="itemPlaceholder" runat="server">
                                        </tr>
                                    </table>
                                </td>
                            </tr>
                            <tr runat="server">
                                <td runat="server" style="text-align: center; background-color: #5D7B9D; font-family: Verdana, Arial, Helvetica, sans-serif;
                                    color: #FFFFFF">
                                    <asp:DataPager ID="DataPager1" runat="server">
                                        <Fields>
                                            <asp:NextPreviousPagerField ButtonType="Button" ShowFirstPageButton="True" ShowLastPageButton="True" />
                                        </Fields>
                                    </asp:DataPager>
                                </td>
                            </tr>
                        </table>
                    </LayoutTemplate>
                    <InsertItemTemplate>
                        <tr style="">
                            <td>
                                <asp:Button ID="InsertButton" runat="server" CommandName="Insert" Text="Insert" />
                                <asp:Button ID="CancelButton" runat="server" CommandName="Cancel" Text="Clear" />
                            </td>
                            <td>
                                <asp:TextBox ID="ModuleNameTextBox" runat="server" Text='<%# Bind("ModuleName") %>' />
                            </td>
                            <td>
                                <asp:TextBox ID="ModuleDescriptionTextBox" runat="server" Text='<%# Bind("ModuleDescription") %>'
                                    TextMode="MultiLine" Rows="1" Columns="20" />
                            </td>
                            <td>
                                <asp:TextBox ID="AssemblyNameTextBox" runat="server" Text='<%# Bind("AssemblyName") %>' />
                            </td>
                            <td>
                                <asp:TextBox ID="ClassNameTextBox" runat="server" Text='<%# Bind("ClassName") %>' />
                            </td>
                            <td>
                                <asp:TextBox ID="IconNameTextBox" runat="server" Text='<%# Bind("IconName") %>' Columns="8" />
                            </td>
                            <td>
                                <asp:DropDownList ID="ddlRoles" runat="server" SelectedValue='<%# Bind("Role") %>'>
                                    <asp:ListItem>Any</asp:ListItem>
                                    <asp:ListItem>Administrators</asp:ListItem>
                                    <asp:ListItem>Users</asp:ListItem>
                                </asp:DropDownList>
                            </td>
                            <td>
                                <asp:TextBox ID="WindowSizeTextBox" runat="server" Text='<%# Bind("WindowSize") %>'
                                    Columns="2" />
                            </td>
                            <td>
                                <asp:CheckBox ID="AllowMultipleInstancesCheckBox" runat="server" Checked='<%# Bind("AllowMultipleInstances") %>' />
                            </td>
                            <td>
                                <asp:TextBox ID="ModuleVersionTextBox" runat="server" Text='<%# Bind("ModuleVersion") %>'
                                    Columns="2" /><asp:HiddenField ID="HiddenField1" runat="server" Value='<%# Bind("uninstall") %>' />
                            </td>
                        </tr>
                    </InsertItemTemplate>
                    <SelectedItemTemplate>
                        <tr style="font-weight: bold; color: #333333;">
                            <td>
                                <asp:Button ID="DeleteButton" runat="server" CommandName="Delete" Text="Delete" />
                                <asp:Button ID="EditButton" runat="server" CommandName="Edit" Text="Edit" />
                            </td>
                            <td>
                                <asp:Label ID="ModuleNameLabel" runat="server" Text='<%# Eval("ModuleName") %>' />
                            </td>
                            <td>
                                <asp:Label ID="ModuleDescriptionLabel" runat="server" Text='<%# Eval("ModuleDescription") %>' />
                            </td>
                            <td>
                                <asp:Label ID="AssemblyNameLabel" runat="server" Text='<%# Eval("AssemblyName") %>' />
                            </td>
                            <td>
                                <asp:Label ID="ClassNameLabel" runat="server" Text='<%# Eval("ClassName") %>' />
                            </td>
                            <td>
                                <asp:Label ID="IconNameLabel" runat="server" Text='<%# Eval("IconName") %>' />
                            </td>
                            <td>
                                <asp:Label ID="RoleLabel" runat="server" Text='<%# Eval("Role") %>' />
                            </td>
                            <td>
                                <asp:Label ID="WindowSizeLabel" runat="server" Text='<%# Eval("WindowSize") %>' Columns="2" />
                            </td>
                            <td>
                                <asp:CheckBox ID="AllowMultipleInstancesCheckBox" runat="server" Checked='<%# Eval("AllowMultipleInstances") %>'
                                    Enabled="false" />
                            </td>
                            <td>
                                <asp:Label ID="ModuleVersionLabel" runat="server" Text='<%# Eval("ModuleVersion") %>'
                                    Columns="2" />
                            </td>
                        </tr>
                    </SelectedItemTemplate>
                    <EmptyDataTemplate>
                        <table runat="server" style="background-color: #FFFFFF; border-collapse: collapse;
                            border-color: #999999; border-style: none; border-width: 1px;">
                            <tr>
                                <td>
                                    There are no modules installed.
                                </td>
                            </tr>
                        </table>
                    </EmptyDataTemplate>
                    <EditItemTemplate>
                        <tr>
                            <td>
                                <asp:Button ID="UpdateButton" runat="server" CommandName="Update" Text="Update" />
                                <asp:Button ID="CancelButton" runat="server" CommandName="Cancel" Text="Cancel" />
                            </td>
                            <td>
                                <asp:TextBox ID="ModuleNameTextBox" runat="server" Text='<%# Bind("ModuleName") %>' />
                            </td>
                            <td>
                                <asp:TextBox ID="ModuleDescriptionTextBox" runat="server" Text='<%# Bind("ModuleDescription") %>'
                                    TextMode="MultiLine" Rows="1" Columns="20" />
                            </td>
                            <td>
                                <asp:TextBox ID="AssemblyNameTextBox" runat="server" Text='<%# Bind("AssemblyName") %>' />
                            </td>
                            <td>
                                <asp:TextBox ID="ClassNameTextBox" runat="server" Text='<%# Bind("ClassName") %>' />
                            </td>
                            <td>
                                <asp:TextBox ID="IconNameTextBox" runat="server" Text='<%# Bind("IconName") %>' Columns="8" />
                            </td>
                            <td>
                                <asp:DropDownList ID="ddlRoles" runat="server" SelectedValue='<%# Bind("Role") %>'>
                                    <asp:ListItem>Any</asp:ListItem>
                                    <asp:ListItem>Administrators</asp:ListItem>
                                    <asp:ListItem>Users</asp:ListItem>
                                </asp:DropDownList>
                            </td>
                            <td>
                                <asp:TextBox ID="WindowSizeTextBox" runat="server" Text='<%# Bind("WindowSize") %>'
                                    Columns="2" />
                            </td>
                            <td>
                                <asp:CheckBox ID="AllowMultipleInstancesCheckBox" runat="server" Checked='<%# Bind("AllowMultipleInstances") %>' />
                            </td>
                            <td>
                                <asp:TextBox ID="ModuleVersionTextBox" runat="server" Text='<%# Bind("ModuleVersion") %>'
                                    Columns="2" /><asp:HiddenField ID="HiddenField1" runat="server" Value='<%# Bind("uninstall") %>' />
                            </td>
                        </tr>
                    </EditItemTemplate>
                    <ItemTemplate>
                        <tr style="color: #333333;">
                            <td>
                                <asp:Button ID="DeleteButton" runat="server" CommandName="Delete" Text="Delete" OnClientClick="return confirm('Are you certain you want to delete ?'); " />
                                <asp:Button ID="EditButton" runat="server" CommandName="Edit" Text="Edit" />
                            </td>
                            <td>
                                <asp:Label ID="ModuleNameLabel" runat="server" Text='<%# Eval("ModuleName") %>' />
                            </td>
                            <td>
                                <asp:Label ID="ModuleDescriptionLabel" runat="server" Text='<%# Eval("ModuleDescription") %>' />
                            </td>
                            <td>
                                <asp:Label ID="AssemblyNameLabel" runat="server" Text='<%# Eval("AssemblyName") %>' />
                            </td>
                            <td>
                                <asp:Label ID="ClassNameLabel" runat="server" Text='<%# Eval("ClassName") %>' />
                            </td>
                            <td>
                                <asp:Label ID="IconNameLabel" runat="server" Text='<%# Eval("IconName") %>' />
                            </td>
                            <td>
                                <asp:Label ID="RoleLabel" runat="server" Text='<%# Eval("Role") %>' />
                            </td>
                            <td>
                                <asp:Label ID="WindowSizeLabel" runat="server" Text='<%# Eval("WindowSize") %>' />
                            </td>
                            <td>
                                <asp:CheckBox ID="AllowMultipleInstancesCheckBox" runat="server" Checked='<%# Eval("AllowMultipleInstances") %>'
                                    Enabled="false" />
                            </td>
                            <td>
                                <asp:Label ID="ModuleVersionLabel" runat="server" Text='<%# Eval("ModuleVersion") %>' />
                            </td>
                        </tr>
                    </ItemTemplate>
                </asp:ListView>
            </p>
            <p>
                Upload New Module</p>
            <p>
                <input type="file" runat="server" id="File1" />
                <asp:Button runat="server" ID="btnUpload" OnClick="btnUpload_Click" Text="Upload" />
            </p>
            <p>
                <asp:Label ID="lblModuleError" runat="server" EnableViewState="False" ForeColor="#FF3300"></asp:Label>
            </p>
        </asp:View>
        <asp:View ID="vwDesktops" runat="server">
            <h2>
                Desktops</h2>
            <asp:Panel ID="pnlSelectDesktop" runat="server">
                <asp:LinkButton ID="lnkNewDesktop" runat="server" OnClick="lnkNewDesktop_Click">[Create New Desktop Instance]</asp:LinkButton>
                <br />
                <br />
                <asp:Label ID="lblSelectDesktop" runat="server" Text="Select Desktop: "></asp:Label>
                <asp:DropDownList ID="ddlDesktopInstances" runat="server" AutoPostBack="True" 
                    DataTextField="DesktopName" DataValueField="ID" 
                    OnSelectedIndexChanged="ddlDesktopInstances_SelectedIndexChanged">
                </asp:DropDownList>
                <br />
                <br />
            </asp:Panel>
            <table align="left">
                <tr>
                    <td nowrap="nowrap">
                        Desktop Name:
                    </td>
                    <td>
                        &nbsp;
                    </td>
                    <td>
                        <asp:TextBox ID="DesktopNameTextBox" runat="server" Columns="40" MaxLength="50" 
                            Text='<%# Bind("DesktopName") %>' />
                    </td>
                </tr>
                <tr>
                    <td nowrap="nowrap">
                        Horizontal:
                    </td>
                    <td>
                        &nbsp;
                    </td>
                    <td>
                        <asp:TextBox ID="DesktopSizeHorizontalTextBox" runat="server" Columns="1" 
                            MaxLength="5" Text='<%# Bind("DesktopSizeHorizontal") %>' />
                    </td>
                </tr>
                <tr>
                    <td nowrap="nowrap">
                        Vertical:
                    </td>
                    <td>
                        &nbsp;
                    </td>
                    <td>
                        <asp:TextBox ID="DesktopSizeVerticalTextBox" runat="server" Columns="1" 
                            MaxLength="5" Text='<%# Bind("DesktopSizeVertical") %>' />
                    </td>
                </tr>
                <tr>
                    <td nowrap="nowrap">
                        Transparent:
                    </td>
                    <td>
                        &nbsp;
                    </td>
                    <td>
                        <asp:CheckBox ID="TransparentCheckBox" runat="server" 
                            Checked='<%# Bind("Transparent") %>' />
                    </td>
                </tr>
                <tr>
                    <td nowrap="nowrap">
                        &nbsp;
                    </td>
                    <td>
                        &nbsp;
                    </td>
                    <td>
                        &nbsp;
                    </td>
                </tr>
                <tr>
                    <td nowrap="nowrap">
                        AutoLoad Module:
                    </td>
                    <td>
                        &nbsp;
                    </td>
                    <td>
                        <asp:DropDownList ID="ddlAutoLoadModule" runat="server" 
                            DataTextField="ModuleName" DataValueField="ModuleID">
                        </asp:DropDownList>
                    </td>
                </tr>
                <tr>
                    <td nowrap="nowrap">
                        <asp:Label ID="lblInstanceUpdated" runat="server" EnableViewState="False" 
                            ForeColor="#FF3300" Text="Updated" Visible="False"></asp:Label>
                    </td>
                    <td>
                        &nbsp;
                    </td>
                    <td align="right">
                        &nbsp;
                    </td>
                </tr>
                <tr>
                    <td colspan="3" nowrap="nowrap">
                        <asp:Button ID="btnSaveDesktopInstance" runat="server" 
                            OnClick="btnSaveDesktopInstance_Click" Text="Save" />
                        &nbsp;
                        <asp:Button ID="btnDeleteInstance" runat="server" 
                            onclick="btnDeleteInstance_Click" 
                            onclientclick="return confirm('Are you certain you want to delete ?');" 
                            Text="Delete" />
                        <asp:Button ID="btnCancelDesktopInstance" runat="server" 
                            onclick="btnCancelDesktopInstance_Click" Text="Cancel" />
                    </td>
                </tr>
            </table>
        </asp:View>
        <asp:View ID="vwApplicationLog" runat="server">
            <h2>
                Application Log
            </h2>
            <p>
                <asp:LinkButton ID="lnkRefresh" runat="server" OnClick="lnkRefresh_Click">[Refresh]</asp:LinkButton>
            </p>
            <p>
                <asp:GridView ID="gvApplicationLog" runat="server" AllowPaging="True" AllowSorting="True"
                    AutoGenerateColumns="False" CellPadding="4" DataKeyNames="LogID" DataSourceID="LDSApplicationLog"
                    ForeColor="#333333" GridLines="None" Width="100%">
                    <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                    <RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
                    <Columns>
                        <asp:BoundField DataField="LogID" HeaderText="LogID" InsertVisible="False" ReadOnly="True"
                            SortExpression="LogID" />
                        <asp:BoundField DataField="UserName" HeaderText="User Name" SortExpression="UserName" />
                        <asp:BoundField DataField="LogDescription" HeaderText="Description" SortExpression="LogDescription" />
                        <asp:BoundField DataField="LogDate" HeaderText="Date" SortExpression="LogDate" />
                    </Columns>
                    <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
                    <EmptyDataTemplate>
                        No Log Data
                    </EmptyDataTemplate>
                    <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
                    <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                    <EditRowStyle BackColor="#999999" />
                    <AlternatingRowStyle BackColor="White" ForeColor="#284775" />
                </asp:GridView>
            </p>
        </asp:View>
    </asp:MultiView>
    <asp:LinqDataSource ID="LDSApplicationLog" runat="server" ContextTypeName="SilverlightDesktopCore.DAL.SilverlightDesktopDAL"
        OrderBy="LogDate desc" TableName="SilverlightDesktopLogs">
    </asp:LinqDataSource>
    <asp:LinqDataSource ID="LDSUsers" runat="server" ContextTypeName="SilverlightDesktopCore.DAL.SilverlightDesktopDAL"
        EnableDelete="True" EnableInsert="True" EnableUpdate="True" TableName="SilverlightDesktopUsers">
    </asp:LinqDataSource>
    <asp:LinqDataSource ID="LDSModuleSettings" runat="server" ContextTypeName="SilverlightDesktopCore.DAL.SilverlightDesktopDAL"
        EnableDelete="True" EnableInsert="True" EnableUpdate="True" OrderBy="ModuleName"
        TableName="SilverlightDesktopModules">
    </asp:LinqDataSource>
    <asp:LinqDataSource ID="LDSDesktopInstancs" runat="server" ContextTypeName="SilverlightDesktopCore.DAL.SilverlightDesktopDAL"
        OrderBy="DesktopName" TableName="SilverlightDesktopInstances">
    </asp:LinqDataSource>
    <asp:LinqDataSource ID="LDSDesktopInstance" runat="server" ContextTypeName="SilverlightDesktopCore.DAL.SilverlightDesktopDAL"
        EnableDelete="True" EnableInsert="True" EnableUpdate="True" TableName="SilverlightDesktopInstances"
        Where="ID == @ID">
        <WhereParameters>
            <asp:ControlParameter ControlID="ddlDesktopInstances" Name="ID" PropertyName="SelectedValue"
                Type="Int32" />
        </WhereParameters>
    </asp:LinqDataSource>
    </form>
</body>
</html>
